<?php
namespace app\controller\demo;

use app\services\tools\WechatService;

class Easywechat extends Application
{
    protected $wechat;

    public function initialize()
    {
        $config = config('wechat.default');
        $wechat = WechatService::getInstance($config);
        $this->wechat = $wechat->getWechat();
    }

    public function getAccesstoken()
    {
        dump($this->wechat->base->getValidIps());
        dump($this->wechat->access_token->getToken());
        dump($this->wechat->url->shorten('https://baidu.com'));
        dump($this->wechat->jssdk->buildConfig(array('onMenuShareQQ', 'onMenuShareWeibo'), true));
    }

    public function getAuth()
    {
        dd(session('wechat_user_default'));
    }
}
